import 'package:flutter_application_1/models/Cart.dart';
import 'package:flutter_application_1/models/User.dart';
import 'package:flutter_application_1/request/request.dart';

Request request = Request();

Future<ResultData<Cart>> testGet(Map<String, dynamic>? data) => request.get(
      url: '/testGet',
      data: data,
    );

Future<ResultData<User>> testPost(Map<String, dynamic>? data) => request.post(
      url: '/testPost',
      data: data,
    );

Future<ResultData<dynamic>> testHeader(Map<String, dynamic>? data) {
  // 自定义请求头
  Request requestHeader = Request(
    headers: data ?? {},
  );
  return requestHeader.get(
    url: '/testHeader',
    data: {},
  );
}

Future<ResultData<dynamic>> testError(Map<String, dynamic>? data) =>
    request.post(
      url: '/testError/sb',
      data: data,
    );
